const SVE = require('../common/base-tool');

class GroupD {
    constructor() {}

    // 给玩家在战斗中增加exp
    add_npc_exp(npc, player) {
        // let exp1 = npc->query("combat_exp"),
        // let exp2 = player->query("combat_exp"), exp;
        let exp1 = npc.exp;
        let exp2 = player.exp;
        let exp = SVE.random( 1, npc.int );

        if( exp1 > exp2*2 ) {
            exp = 1;
        } else if( exp1<exp2/2 || exp1>exp2*3/2 ) {
            exp /= 5;
        } else if( exp1<exp2*3/4 || exp1>exp2*5/4 ) {
            exp /= 2;
        }
        npc.add = combat_exp;
        // tell_object(player,"npc_exp: "+exp+" | ");
        return "npc_exp: "+exp+" | ";
    }
}

module.exports = GroupD